# coding = UTF-8
# AD模转数
import smbus
import time

bus = smbus.SMBus(1)

addr = 0x48

while True:
    # 0b00000000  通道0, x
    # 0b00000001  通道1, y
    # 0b00000010  通道2, button
    # 0b00000011  通道3,
    # 写入控制字 control byte
    # bus.write_byte(addr,0b00000010)
    # bus.write_byte(addr,0x01)
    ain = ['x','y','press']
    for i in range(3):
        bus.write_byte(addr,i)
        # 读取采样数据
        read_res = bus.read_byte(addr)
        print(i, ain[i], read_res)
    time.sleep(0.5)